
#ifndef __RSP_CONTROLLER__HEADER_FILE__
#define __RSP_CONTROLLER__HEADER_FILE__


#include "rsp_def.h"

struct rsp_controller;
extern rsp_controller*              Gactive_controller;

////////////////////////////////////////////////////////////////////////////////
struct rsp_controller
{
    uint get_current_stateid() const        { return _stateid; }
    const uint* get_current_stateid_ptr() const { return &_stateid; }

    static uint get_frame_usec()            { return _Timer.get_period_usec(); }

    bool client_side() const                { return _ctrltype == CT_CLIENT; }
    bool room_controller() const            { return _ctrltype == CT_SERVER_ROOM; }

    virtual ~rsp_controller() {}


    virtual opcd register_object( rsp_base* o, const token& cname )
    {
        return ersNOT_IMPLEMENTED;
    }


    explicit rsp_controller( int ctrltype ) : _ctrltype(ctrltype)
    {
        _stateid = UMAX;
        Gactive_controller = this;
    }


protected:

    uint _stateid;                          ///< current state id
    int  _ctrltype;

    ///controller type
    enum {
        CT_CLIENT               = -1,
        CT_SERVER_ROOM          = 1,
    };
};


#endif //__RSP_CONTROLLER__HEADER_FILE__
